WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::Buffer< T > Class Template Reference

Buffer for arbitrary type objects. More...

#include <core/processor/buffer.h>

Public Types

typedef std::map< TimeStamp, T >::iterator Iterator
 Buffer iterator. More...
 
typedef std::map< TimeStamp, T >::const_iterator ConstIterator
 Buffer const iterator. More...
 

Public Member Functions

 Buffer ()
 Default constructor. More...
 
 ~Buffer (void)
 Destructor. More...
 
T select (const TimeStamp &_time_stamp, const double &_time_tolerance) const
 Select an element from the buffer. More...
 
ConstIterator selectIterator (const TimeStamp &_time_stamp, const double &_time_tolerance) const
 Select an element iterator from the buffer. More...
 
Iterator selectIterator (const TimeStamp &_time_stamp, const double &_time_tolerance)
 Select an element iterator from the buffer (see the const version) More...
 
T selectFirstBefore (const TimeStamp &_time_stamp, const double &_time_tolerance) const
 Returns the oldest element if it is older than _time_stamp or within the time tolerance (T() otherwise) More...
 
T selectLastAfter (const TimeStamp &_time_stamp, const double &_time_tolerance) const
 Returns the newest element if it is newer than _time_stamp or within the time tolerance (T() otherwise) More...
 
T selectFirst () const
 Returns the oldest element (T() if empty) More...
 
T selectLast () const
 Returns the newest element (T() if empty) More...
 
SizeStd size (void) const
 Returns the number of elements of the buffer. More...
 
void emplace (const TimeStamp &_time_stamp, const T &_element)
 Adds an element to the buffer. More...
 
const std::map< TimeStamp, T > & getContainer () const
 Returns the container with elements of the buffer. More...
 
std::map< TimeStamp, T > & getContainer ()
 Returns the container with elements of the buffer. More...
 
void removeUpTo (const TimeStamp &_time_stamp)
 Removes all elements in the buffer with a time stamp older than or equal to the specified. More...
 
void removeUpToLower (const TimeStamp &_time_stamp)
 Removes all elements in the buffer with a time stamp older than the specified. More...
 
void clear ()
 Clears the buffer. More...
 
bool empty () const
 Returns whether the buffer is empty. More...
 

Static Public Member Functions

static bool checkTimeTolerance (const TimeStamp &_time_stamp1, const TimeStamp &_time_stamp2, const double &_time_tolerance)
 Returns whether the time distance between two time stamps is smaller than or equal to the time tolerance. More...
 
static bool doubleCheckTimeTolerance (const TimeStamp &_time_stamp1, const double &_time_tolerance1, const TimeStamp &_time_stamp2, const double &_time_tolerance2)
 Returns whether the time distance between two time stamps is smaller than or equal to the minimum of their time tolerances. More...
 

Protected Attributes

std::map< TimeStamp, T > container_
 Main buffer container, ordered by time stamp. More...
 

Detailed Description

template<typename T>
class wolf::Buffer< T >

Buffer for arbitrary type objects.

Object and functions to manage a buffer of objects.

Member Typedef Documentation

◆ ConstIterator

template<typename T >
typedef std::map<TimeStamp,T>::const_iterator wolf::Buffer< T >::ConstIterator

Buffer const iterator.

◆ Iterator

template<typename T >
typedef std::map<TimeStamp,T>::iterator wolf::Buffer< T >::Iterator

Buffer iterator.

Constructor & Destructor Documentation

◆ Buffer()

template<typename T >
wolf::Buffer< T >::Buffer ( )
inline

Default constructor.

◆ ~Buffer()

template<typename T >
wolf::Buffer< T >::~Buffer ( void  )
inline

Destructor.

Member Function Documentation

◆ checkTimeTolerance()

template<typename T >
bool wolf::Buffer< T >::checkTimeTolerance ( const TimeStamp &  _time_stamp1,
const TimeStamp &  _time_stamp2,
const double &  _time_tolerance 
)
inlinestatic

Returns whether the time distance between two time stamps is smaller than or equal to the time tolerance.

◆ clear()

template<typename T >
void wolf::Buffer< T >::clear
inline

Clears the buffer.

◆ doubleCheckTimeTolerance()

template<typename T >
bool wolf::Buffer< T >::doubleCheckTimeTolerance ( const TimeStamp &  _time_stamp1,
const double &  _time_tolerance1,
const TimeStamp &  _time_stamp2,
const double &  _time_tolerance2 
)
inlinestatic

Returns whether the time distance between two time stamps is smaller than or equal to the minimum of their time tolerances.

◆ emplace()

template<typename T >
void wolf::Buffer< T >::emplace ( const TimeStamp &  _time_stamp,
const T &  _element 
)
inline

Adds an element to the buffer.

◆ empty()

template<typename T >
bool wolf::Buffer< T >::empty
inline

Returns whether the buffer is empty.

◆ getContainer() [1/2]

template<typename T >
std::map< TimeStamp, T > & wolf::Buffer< T >::getContainer
inline

Returns the container with elements of the buffer.

◆ getContainer() [2/2]

template<typename T >
const std::map< TimeStamp, T > & wolf::Buffer< T >::getContainer
inline

Returns the container with elements of the buffer.

Elements are ordered by time stamp, from oldest to most recent

◆ removeUpTo()

template<typename T >
void wolf::Buffer< T >::removeUpTo ( const TimeStamp &  _time_stamp)
inline

Removes all elements in the buffer with a time stamp older than or equal to the specified.

◆ removeUpToLower()

template<typename T >
void wolf::Buffer< T >::removeUpToLower ( const TimeStamp &  _time_stamp)
inline

Removes all elements in the buffer with a time stamp older than the specified.

◆ select()

template<typename T >
T wolf::Buffer< T >::select ( const TimeStamp &  _time_stamp,
const double &  _time_tolerance 
) const
inline

Select an element from the buffer.

Select from the buffer the closest element (w.r.t. time stamp), respecting a defined time tolerances

◆ selectFirst()

template<typename T >
T wolf::Buffer< T >::selectFirst
inline

Returns the oldest element (T() if empty)

◆ selectFirstBefore()

template<typename T >
T wolf::Buffer< T >::selectFirstBefore ( const TimeStamp &  _time_stamp,
const double &  _time_tolerance 
) const
inline

Returns the oldest element if it is older than _time_stamp or within the time tolerance (T() otherwise)

◆ selectIterator() [1/2]

template<typename T >
Buffer< T >::Iterator wolf::Buffer< T >::selectIterator ( const TimeStamp &  _time_stamp,
const double &  _time_tolerance 
)
inline

Select an element iterator from the buffer (see the const version)

◆ selectIterator() [2/2]

template<typename T >
Buffer< T >::ConstIterator wolf::Buffer< T >::selectIterator ( const TimeStamp &  _time_stamp,
const double &  _time_tolerance 
) const
inline

Select an element iterator from the buffer.

Select from the buffer the iterator pointing to the closest element (w.r.t. time stamp), respecting a defined time tolerances

◆ selectLast()

template<typename T >
T wolf::Buffer< T >::selectLast
inline

Returns the newest element (T() if empty)

◆ selectLastAfter()

template<typename T >
T wolf::Buffer< T >::selectLastAfter ( const TimeStamp &  _time_stamp,
const double &  _time_tolerance 
) const
inline

Returns the newest element if it is newer than _time_stamp or within the time tolerance (T() otherwise)

◆ size()

template<typename T >
SizeStd wolf::Buffer< T >::size ( void  ) const
inline

Returns the number of elements of the buffer.

Member Data Documentation

◆ container_

template<typename T >
std::map<TimeStamp, T> wolf::Buffer< T >::container_
protected

Main buffer container, ordered by time stamp.


The documentation for this class was generated from the following file: